<?php
/**
 * Minhlog Domain_Model 用户类
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   Domain
 * @package    Domain_Model
 * @copyright  Copyright (c) 2009-2010 Minh.Shu@gmail.com
 * @license    New BSD License
 * @author     Minh.Shu
 * @version    $Id: User.php 2 2010-01-17 13:49:08Z Minh.Shu $
 *
 */

class Domain_Model_User
{
    protected $_userDataMapper;
    protected $_userEntity;

    public function  __construct() {
        $this->_userDataMapper = new Domain_DataMapper_User();
        $this->_userEntity = new Domain_Entity_User();
        $this->_userDataMapper->setEntity($this->_userEntity);
    }

    /**
     * 根据用户ID查询信息
     * @param integer $userId
     * @return object|void
     */
    public function getUserById ($userId)
    {
        $userId = (int) $userId;
        $result = $this->_userDataMapper->findByPrimaryId($userId);
        return $result;
    }

    /**
     * 查询全部用户信息
     * @return object|void
     */
    public function getAllUser()
    {
        $result = $this->_userDataMapper->fetchAllUser();
        return $result;
    }
}